<template>
  <!-- <div class="app-main-container">
    <div class="app-main-title">
      订单详情
      <div class="goback" @click="goBack">
        <i class="el-icon-refresh-left" /> 返回上一页
      </div>
    </div> -->
  <el-drawer
    title="订单详情"
    :visible.sync="isShowModal"
    size="1000px"
    :wrapper-closable="!modalDialog"
  >
    <div class="property-title">订单信息</div>
    <div class="df_ac">
      <div>
        <span class="key">订单编号：</span>
        <span class="value">{{ detail.orderId }}</span>
      </div>
      <div>
        <span class="key">订单状态：</span>
        <span class="value">{{ detail.orderStatus }}</span>
      </div>
      <div>
        <span class="key">创建时间：</span>
        <span class="value">{{ detail.orderTime }}</span>
      </div>
      <div v-if="detail.payTime">
        <span class="key">支付时间：</span>
        <span class="value">{{ detail.payTime }}</span>
      </div>
      <div>
        <span class="key">订单来源：</span>
        <span class="value">{{ detail.fromType == '01' ? '小程序' : '场馆pc端' }}</span>
      </div>
      <div>
        <span class="key">订单金额：</span>
        <span class="value">{{ detail.orderPrice }}</span>
      </div>
      <div>
        <span class="key">支付方式：</span>
        <span class="value">{{ detail.payMethod || '-' }}</span>
      </div>
      <div>
        <span class="key">操作员：</span>
        <span class="value">{{ detail.createUser || '-' }}</span>
      </div>
      <div>
        <span class="key">备注：</span>
        <span class="value">{{ detail.remake }}</span>
      </div>
    </div>

    <div class="line-style mb20" />
    <div class="property-title">开票情况</div>
    <div class="df_ac">
      <div>
        <span class="key">开票状态：</span>
        <span class="value">{{ detail.invoiceStatus }}</span>
      </div>
      <div>
        <span class="key">开票时间：</span>
        <span class="value">{{ detail.invoiceTime || "~" }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">买家信息</div>
    <div class="df_ac mt20">
      <div>
        <span class="key">姓名：</span>
        <span class="value">{{ detail.memberName }}</span>
      </div>
      <div>
        <span class="key">联系电话：</span>
        <span class="value">{{ detail.memberPhone }}</span>
      </div>
      <div v-if="detail.memberId">
        <span class="key">会员卡号：</span>
        <span class="value">{{ detail.memberId }}</span>
      </div>
    </div>
    <div class="line-style mb20" />
    <div class="property-title">卡信息</div>

    <el-table
      :data="detail.orderDetailListTemp"
      element-loading-text="Loading"
      border
      fit
      :header-row-class-name="'table-header'"
      class="doumee-element-table"
    >
      <el-table-column
        align="center"
        label="专项卡名称"
        prop="name"
        min-width="180"
        show-overflow-tooltip
      />
      <el-table-column
        align="center"
        label="卡本金"
        prop="cardPrice"
        min-width="140"
        show-overflow-tooltip
      />
      <el-table-column align="center" label="赠送金额" min-width="100">
        <template v-slot="scope">
          <span>{{ scope.row.givePrice }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="销售数量" min-width="100">
        <template v-slot="scope">
          <span>{{ scope.row.num }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="销售价" min-width="100">
        <template v-slot="scope">
          <span>{{ scope.row.price }}</span>
        </template>
      </el-table-column>
      <el-table-column align="center" label="状态" min-width="100">
        <template v-slot="scope">
          <span>{{ scope.row.payStatus }}</span>
        </template>
      </el-table-column>
    </el-table>

    <div v-if="detail.detailMoneyRespParam" class="bottom_wrap">
      <div v-if="detail.detailMoneyRespParam.orderPrice" class="line">
        <span>订单商品金额：</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.orderPrice || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.memberDiscount" class="line">
        <span>会员折扣：</span>
        <span v-if="detail.detailMoneyRespParam.memberDiscount">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.memberDiscount || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.marketingPolicy" class="line">
        <span>营销政策：</span>
        <span v-if="detail.detailMoneyRespParam.marketingPolicy">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.marketingPolicy || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.groupBuyCoupon" class="line">
        <span>团购券：</span>
        <span v-if="detail.detailMoneyRespParam.groupBuyCoupon">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.groupBuyCoupon || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.discountCoupon" class="line">
        <span>优惠券：</span>
        <span v-if="detail.detailMoneyRespParam.discountCoupon">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.discountCoupon || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.integral" class="line">
        <span>积分抵扣：</span>
        <span v-if="detail.detailMoneyRespParam.integral">-</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.integral || 0 }}</span>
        <span>元</span>
      </div>
      <div v-if="detail.detailMoneyRespParam.getPrice || detail.detailMoneyRespParam.getPrice === 0" class="line secondColor">
        <span>实收款：</span>
        <span v-if="detail.detailMoneyRespParam">{{ detail.detailMoneyRespParam.getPrice || 0 }}</span>
        <span>元</span>
      </div>
    </div>
  </el-drawer>
  <!--</div> -->
</template>

<script>
import { SecKillOrderDetail } from '@/api'
import store from '@/store'
export default {
  data() {
    return {
      detail: {},
      modalDialog: store.getters.dialog,
      isShowModal: false
    }
  },
  methods: {
    goBack() {
      this.$router.replace('/ticket/ticketOrder')
    },
    getDetail(orderId) {
      SecKillOrderDetail({ param: { orderId }}).then((res) => {
        if (res.errorCode === '000000') {
          this.isShowModal = true
          this.detail = res.record
          if (res.record.orderDetailList && res.record.orderDetailList.price) {
            const orderDetailListTemp = []
            orderDetailListTemp.push(res.record.orderDetailList)
            this.$set(this.detail, 'orderDetailListTemp', orderDetailListTemp)
          }
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>

.df_ac {
  flex-wrap: wrap;
  div {
    width: 33.33%;
    margin-bottom: 20px;
    .key {
  color: #666666;
  display: inline-block;
  // width: 90px;
  // text-align: right;
}
.value {
  color: #222;
}
  }
}
.bottom_wrap {
  margin-top: 30px;
  text-align: right;
  .line {
    margin-bottom: 10px;
  }
}
</style>
